<template>
	<view class="inquire flex-column">
		<u--form labelPosition="left" :model="userInfo" :rules="rules" ref="uform" class="formList m-t-18"
			labelWidth="120px">
			<u-form-item label="姓名:" prop="name" borderBottom leftIcon="../../static/images/name-ico.svg">
				<u--input v-model="userInfo.name" border="none" placeholder="请输入姓名"></u--input>
			</u-form-item>
			<u-form-item label="身份证/住院号:" prop="cardNumber" leftIcon="../../static/images/idcard-ico.svg">
				<u--input maxlength="18" v-model="userInfo.cardNumber" @input="TypeInput($event)" border="none"
					placeholder="身份证号/住院号">
				</u--input>
			</u-form-item>

		</u--form>

		<u-button class="submit_but" text="查询" throttleTime="500" @click="submit('uform')"></u-button>

	</view>
</template>

<script>
	import {
		// inquireSee,
		// inquireSeeReport,
		// smsCode,
		// checkSmsCode,
		// searchPhone,
		// normal,
		// searchPhoneReport,
		// getConfigByKeys
	} from "@/api/beInHospital";
	export default {
		data() {
			return {
				isRequired: true,
				userInfo: {
					name: '',
					cardNumber: ''
				},
				mobileSeeReportMsg: '0',
				rules: {
					'name': {
						type: 'string',
						required: true,
						message: '请填写姓名',
						trigger: ['blur', 'change']
					},
					'cardNumber': [{
							type: 'string',
							required: true,
							message: '格式不正确',
							trigger: ['blur'],
						},
					]
				},
				code: '',
			}
		},
		components: {

		},
		onLoad(res) {

		},
		methods: {
			submit(uForm) {
				this.$refs[uForm].validate().then(res => {
					let name = encodeURIComponent(this.userInfo.name)
					uni.navigateTo({
						url: '/pages/beInHospital/oneDayListByYourSelf?name=' + name + '&cardNumber=' + this.userInfo.cardNumber
					})

				})
			},

			TypeInput(e, val) {
				const inputType = /[\u4e00-\u9fa5]/ig
				this.$nextTick(function() {
					this.userInfo.cardNumber = e.replace(inputType, '');
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		height: 100%;

		::v-deep .u-form-item__body__left__content__label {
			font-size: 26rpx !important;
		}

		.clear-phone {
			margin-right: 20rpx;
		}

		.msg-code {
			font-size: 28rpx;
			width: 90px;
			display: flex;
			justify-content: center;
			border-left: 1px solid #999999;

			.normal {
				color: #999999;
			}

			.active {
				color: #377aff;
			}
		}


		.inquire {
			width: 100%;
			height: 100%;


			.formList {
				width: 100%;
				padding: 0 40rpx 20rpx 40rpx;
				background: #fff;

				::v-deep .u-icon__img {
					margin-top: 2px !important;
				}
			}
		}
	}
</style>